<style src="./index.scss" lang="scss" scoped rel="stylesheet/scss"></style>
<template src="./index.html"></template>
<script>
export default {
    components: {
        
    },
    props: {
        // 使用者window实例 必定义
        appWindow: {
            type: Object,
            default: null,
        },
        // 接口列表
        apiConfig: {
            type: Object,
            default: {
                // 素材配置
                fileConfig: {
                    url: "mall-site-portal/album-info/getFileConfig",
                },
                // 素材创建
                createSubmit: {
                    url: "mall-site-portal/album-info/create",
                },
                // 分组列表
                albumList: {
                    url: "mall-site-portal/album/listAll",
                },
                // 分组添加
                albumAdd: {
                    url: "mall-site-portal/album/create",
                },
                // 分组删除
                albumDel: {
                    url: "mall-site-portal/album/delete",
                },
                // 分组编辑
                albumEdit: {
                    url: "mall-site-portal/album/update",
                },
                // 数据列表
                dataList: {
                    url: "mall-site-portal/album-info/list",
                },
                // 数据删除
                dataDel: {
                    url: "mall-site-portal/album-info/delete",
                },
                // 数据修改
                dataEdit: {
                    url: "mall-site-portal/album-info/update",
                },
                // 数据同步
                dataSync: {
                    url: "mall-site-portal/album-info/materialUpload",
                },
            },
        },
        value: {
            type:String,
            default() {
                return "";
            },
        },
        mode: {
            type:String,
            default() {
                return "";
            },
        },

    },
    computed: {
       
    },
    data() {
        return {
            // 选择图片

            dragging: null,
        };
    },
    methods: {
   

        // 删除选择
        delSelectData() {
            this.updateValue("");
        },

        openBox() {
            this.$vFN.Directives.SelectResourcesImage({
                mode: this.mode,
                appWindow: this.appWindow,
                apiConfig: this.apiConfig,
                count:1,
                onSuccess: (res) => {
                    
                    this.updateValue(res.data[0]);
                },
            });
        },

        updateValue(v_) {
            this.$emit("input", v_);
        },
    },
    watch: {},
    mounted() {},
    beforeCreate() {},
};
</script>